<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        // put your code here
        require_once '../../../config.php';
        include_once "ModelClass.php";
        



        function muestraArbol(){
            $result=DB::query("SELECT node.lft, node.rgt, node.type,CONCAT( REPEAT( '__', (COUNT(parent.value) - 1) ), node.value) AS value
                                FROM "."pru_"."block_modulo_control_tutorial_structure AS node,
                                "."pru_"."block_modulo_control_tutorial_structure AS parent
                                WHERE node.lft BETWEEN parent.lft AND parent.rgt
                                GROUP BY node.value
                                ORDER BY node.lft;");

            while ($r1=DB::fetch_assoc($result)){
                $fields= explode ('/',$r1['value']);
                $nc=count($fields);
                $n=array();
                for($i=0;$i<$nc-1;$i++){
                    $n[$i]=$fields[$i];
                }
                $n1=implode('/',$n);
                echo "<font color='#FF0000'>$n1</font>";
                echo "<font color='#0000CC'>/". $fields[$nc-1] ."</font>";
                echo "<font color='#339966'> ". $r1['type']."</font>";
                echo "<font color='#FF0000'> (".$r1['lft']."|".$r1['rgt'].") </font><BR>";
            }

        }

 


        $model=new Model();
        $model->initializeStruct();
        $model->loadXML("esquemafinal.xml");
    //    $model->printArraysXML();
       $model->loadStructure(true);
    //    echo "<BR>";
        muestraArbol();
        ?>
    </body>
</html>
